import { ModuleMetadata, Type } from '@nestjs/common'

export interface AuthModuleOptions {
  // rpc secret
  rpcSecret: string
  // jwt secret will be used to sign tokens
  jwtSecret: string
  // discord client id
  clientID: string
  // discord client secret
  clientSecret: string
  // discord oauth2 scopes
  scope: string
  // encryption secret will be used to encrypt tokens in the database
  encryptionSecret: string
  // encryption salt will be used to encrypt tokens more securely
  encryptionSalt: string
}

export interface AuthModuleOptionsFactory {
  createAuthOptions(): AuthModuleOptions | Promise<AuthModuleOptions>
}

export interface AuthModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
  useExisting?: Type<AuthModuleOptionsFactory>
  useClass?: Type<AuthModuleOptionsFactory>
  inject?: any[]
  useFactory?: (...args: any[]) => Promise<AuthModuleOptions> | AuthModuleOptions
}
